#include <stdio.h>

void print1(int arr[3][5], int r, int c)
{
    int i = 0;
    for(i = 0; i < r; i++)
    {
        int j = 0;
        for(j = 0; j < c; j++)
        {
            printf("%d ", arr[i][j]);
        }
        printf("\n");
    }
}

void print2(int (*p)[5], int r, int c)//二维数组的数组名实质上是第一行的地址
{
    int i = 0;
    for(i = 0; i < r; i++)
    {
        int j = 0;
        for(j = 0; j < c; j++)
        {
            printf("%d ", *(*(p + i) + j));//(p+i)相当于每一行的数组名,也可以写作*(p+i)[j]或p[i][j]
        }
        printf("\n");
    }
}

int main()
{
    int arr[3][5] = {{1,2,3,4,5}, {2,3,4,5,6}, {3,4,5,6,7}};
    printf("int arr[3][5]\n");
    print1(arr, 3, 5);
    printf("int (*p)[5]\n");
    print2(arr, 3, 5);
    return 0;
}